
DIR = "/Users/kklo/Downloads/phrase_cards"

Dir.foreach(DIR) do |x|
  unless File.directory?(x)
    state = :initial_state
    card_no = ""
    
    File.open(DIR + "/" + x, "r").each_line do |s|
            
      
      if s.strip.length != 0 && s[0].chr != '-'
        if state == :initial_state
          card_no = s.strip
          state = :reading
        else
          #reading a phrase card
          puts "@card[#{card_no}] = \"#{s.strip}\""
          state = :initial_state #reset state
        end
      end
      
    end
  end 
end  
  
